Research
Security News
Kill Switch Hidden in npm Packages Typosquatting Chalk and Chokidar
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
@turf/projection
Advanced tools
@turf/projection is a module within the Turf.js library that provides functionality for projecting geographical coordinates. It allows for the conversion of coordinates between different coordinate reference systems (CRS), which is essential for various geospatial analyses and visualizations.
toMercator
Converts a GeoJSON object from geographic coordinates (longitude, latitude) to Mercator (x, y) coordinates.
const turf = require('@turf/turf');
const point = turf.point([-75.343, 39.984]);
const projected = turf.toMercator(point);
console.log(projected);
toWgs84
Converts a GeoJSON object from Mercator (x, y) coordinates to geographic coordinates (longitude, latitude).
const turf = require('@turf/turf');
const point = turf.point([0, 0]);
const projected = turf.toWgs84(point);
console.log(projected);
Proj4 is a JavaScript library for converting coordinates between different coordinate reference systems. It is highly versatile and supports a wide range of projections. Compared to @turf/projection, proj4 offers more extensive support for various CRS and is often used in more complex geospatial applications.
Converts a WGS84 GeoJSON object into Mercator (EPSG:900913) projection
options
Object? Optional parameters (optional, default {}
)
options.mutate
boolean allows GeoJSON input to be mutated (significant performance increase if true) (optional, default false
)var pt = turf.point([-71,41]);
var converted = turf.toMercator(pt);
//addToMap
var addToMap = [pt, converted];
Returns GeoJSON Projected GeoJSON
Converts a Mercator (EPSG:900913) GeoJSON object into WGS84 projection
options
Object? Optional parameters (optional, default {}
)
options.mutate
boolean allows GeoJSON input to be mutated (significant performance increase if true) (optional, default false
)var pt = turf.point([-7903683.846322424, 5012341.663847514]);
var converted = turf.toWgs84(pt);
//addToMap
var addToMap = [pt, converted];
Returns GeoJSON Projected GeoJSON
This module is part of the Turfjs project, an open source module collection dedicated to geographic algorithms. It is maintained in the Turfjs/turf repository, where you can create PRs and issues.
Install this single module individually:
$ npm install @turf/projection
Or install the all-encompassing @turf/turf module that includes all modules as functions:
$ npm install @turf/turf
FAQs
turf projection module
The npm package @turf/projection receives a total of 623,461 weekly downloads. As such, @turf/projection popularity was classified as popular.
We found that @turf/projection demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.